package per.qiao.simplerest.restresolver;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * Company: 上海数惠系统技术有限公司
 * Department: 数据中心
 * Date: 2020-05-31 14:45
 *
 * @Author: qyp
 * Email: qiaoyp@dist.com.cn
 * Desc:
 */
@Component
@ConfigurationProperties(prefix = "rest.service")
public class RestAutoConfigBean {

    private String baseackages;

    private String base;

    private final RestTemplateComponent restTemplateComponent = new RestTemplateComponent();

    public String getBaseackages() {
        return baseackages;
    }

    public void setBaseackages(String baseackages) {
        this.baseackages = baseackages;
    }

    public String getBase() {
        return base;
    }

    public void setBase(String base) {
        this.base = base;
    }

    public RestTemplateComponent getRestTemplateComponent() {
        return restTemplateComponent;
    }


    public class RestTemplateComponent {

        /**
         * 是否缓存结果
         */
        private boolean cacheResult = false;

        /**
         * 使用的客户端
         */
        private String requestFactory;

        /**
         * 连接超时
         */
        private int connectTimeout = 5000;

        /**
         * 传递数据的超时时间
         */
        private int readTimeout = 5000;


        public boolean isCacheResult() {
            return cacheResult;
        }

        public void setCacheResult(boolean cacheResult) {
            this.cacheResult = cacheResult;
        }

        public String getRequestFactory() {
            return requestFactory;
        }

        public void setRequestFactory(String requestFactory) {
            this.requestFactory = requestFactory;
        }

        public int getConnectTimeout() {
            return connectTimeout;
        }

        public void setConnectTimeout(int connectTimeout) {
            this.connectTimeout = connectTimeout;
        }

        public int getReadTimeout() {
            return readTimeout;
        }

        public void setReadTimeout(int readTimeout) {
            this.readTimeout = readTimeout;
        }
    }
}
